var checkMobile = (rule, value, cb) => {
  const regMobile = /^1[0-9]{10}$/
  if (regMobile.test(value)) {
    return cb()
  }
  cb(new Error('请输入合法的手机号'))
}

export const editFormRules = {
  unitName: [
    { required: true, message: '请输入单位名称', trigger: 'blur' },
    { min: 3, message: '长度不少于 3 个字符', trigger: 'blur' }
  ],
  customPhone: [
    {required: true, message: '请输入联系电话', trigger: 'blur' },
    { validator: checkMobile, trigger: 'blur' }
  ],
}

export const editFormOptions = [
  {
    label: '单位名称',
    type: 'input',
    key: 'unitName',
    props: {
      placeholder: '请输入单位名称'
    }
  },
  {
    label: '联系电话',
    type: 'input',
    key: 'customPhone',
    props: {
      placeholder: '请输入联系电话'
    }
  }
]
